home *** CD-ROM | disk | FTP | other *** search
- Path: inforamp.net!ts24-15
- From: rmorin@inforamp.net (Randy Charles Morin)
- Newsgroups: comp.lang.c++
- Subject: Re: Truncate binaryfile at a special position
- Date: Tue, 12 Mar 96 04:52:02 GMT
- Organization: MiddleWorld SoftWare
- Message-ID: <4i2vu2$psp@sam.inforamp.net>
- References: <314437C0.41C67EA6@theoinf.tu-ilmenau.de>
- NNTP-Posting-Host: ts24-15.tor.inforamp.net
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <314437C0.41C67EA6@theoinf.tu-ilmenau.de>,
- Gregor Gaertner <gregor.gaertner@theoinf.tu-ilmenau.de> wrote:
- >I have the following problem:
- >I have a file, where the last 200 bytes are useless. No I want to
- >truncate the last 200 bytes, but I don't know how to realize this with
- >the help of the streamclasses in C++. The way to copy the part until the
- >useless bytes to a new file is not acceptable for me, because if the
- >file is 20 Mb long and I want only to cut 200 bytes from the end, I need
- >with this insufficient method 20Mb free space more on the harddisc total
- >because of the copy.
- >Can anyone help ???
-
- Have you tried something like
-
- ofstream os(filename);
- os.seekp(200, end);
- os << endl;
-
- or
-
- ofstream os(filename);
- os.seekp(200, end);
- os.ignore(200);
-
- Just a few suggestion, I don't know if they works.
- Actually, I doubt the first one words.
-
- Agrivar
-